using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace GEContentPipeline
{
    /// <summary>
    /// This class will be instantiated by the XNA Framework Content Pipeline
    /// to write the specified data type into binary .xnb format.
    ///
    /// This should be part of a Content Pipeline Extension Library project.
    /// </summary>
    [ContentTypeWriter]
    public class GEModelTagTypeWriter : ContentTypeWriter<GEModelTag>
    {
        protected override void Write(ContentWriter output, GEModelTag value)
        {
            output.WriteObject(value.Animations);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(GEModelTagTypeWriter).AssemblyQualifiedName;
        }
    }

    [ContentTypeWriter]
    public class GEAnimationClipTypeWriter : ContentTypeWriter<GEAnimationClip>
    {
        protected override void Write(ContentWriter output, GEAnimationClip value)
        {
            output.WriteObject(value.Duration);
            output.WriteObject(value.KeyFrames);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(GEAnimationClipTypeWriter).AssemblyQualifiedName;
        }
    }

    [ContentTypeWriter]
    public class GEKeyframeTypeWriter : ContentTypeWriter<GEKeyframe>
    {
        protected override void Write(ContentWriter output, GEKeyframe value)
        {
            output.WriteObject(value.TimeSpan);
            output.WriteObject(value.Transform);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(GEKeyframeTypeWriter).AssemblyQualifiedName;
        }
    }
}
